using System;
using ExamServer.Entities;

namespace ExamServer.Service
{
  public class RepositoryWrapper : IRepositoryWrapper
  {
    private readonly ExamServerContext context;
    private IUsersRepository _users = null;
    private IQuestionTypeRepository _questionTypes = null;
    private IMenusRepository _menus = null;

    private IviewUserHaveMenusRepository _userHaveMenus = null;
    private IRolesRepository _roles = null;

    public RepositoryWrapper(ExamServerContext context)
    {
      this.context = context;
    }
    public IUsersRepository Users => _users ??
    new UsersRepository(context);

    public IQuestionTypeRepository QuestionTypes => _questionTypes
    ?? new QuestionTypeRepository(context);

    public IMenusRepository Menus => _menus
    ?? new MenusRepository(context);

    public IviewUserHaveMenusRepository UserHaveMenus => _userHaveMenus
    ?? new viewUserHaveMenusRepository(context);

    public IRolesRepository Roles => _roles ?? new RolesRepository(context);


  }
}
